
#ifndef __SIP__PARAM__HEADER__
#define __SIP__PARAM__HEADER__

#include <string>
#include "osipparser2/headers/osip_header.h"
#include "osipparser2/headers/osip_from.h"

class ConfigParam
{
public:
    ConfigParam();
    bool load_config(const std::string& filepath = "./config.ini");
    bool gen_config(const std::string& filepath = "./config.ini");

    std::string get_from() const;
    std::string get_protocol() const;
    const char* get_displayname_str() const;
    const char* get_username_str() const;
    const char* get_password_str() const;
    std::string get_proxy() const;
    bool exist_route() const;
    std::string get_route() const;
    std::string get_to(const std::string& target) const;

    // Log section
    bool mSipLogEnable;
    int mSipLogLevel;
    std::string mSipLogFileName;
    std::string mConsoleLogLevel;

    // Main section
    std::string mLocalAddress;
    int         mLocalPort;
    std::string mFromString;
    osip_from_t *mFrom;         //parsed osip_from_t from mFromString
    std::string mServerString;
    osip_uri_t  *mServerUri;    //parsed osip_from_t from mServerString
    bool        mAutoMasqueradeContact;
    std::string mContactString;
    std::string mUserAgentText;

    // Reg section
    int         mRegExpires;
    bool        mRegAfterLoad;

    // Call section
    bool        mAutoAnswerCall;

};

#endif // #ifndef __SIP__PARAM__HEADER__

/*

## log settings
[Log]
# enable or disable sip stack log, default is true
SipLogEnable=true
# log level 0 - 7(TRACE_LEVEL0 - TRACE_LEVEL7), default is 7
LogLevel=7
# log file path name for sip stack log, default is siplog.log
LogFileName=siplog.log

## Main settings
[Main]
# local address for sip, if left blank, sip will bind all interface, default is blank
Address=
# local port for sip register, default is 0 for random port
Port=0
# address of record which usually used as visible public, can not be blank!
# likely as '"display-name" <sip:user-name[:password]@domain[:port][;parameters...]>[;parameters...]'
# The optional 'display-name' is meant to be rendered by a human user interface.
# The 'user-name' and 'password' is for authentication
# The 'domain' and 'port' is the domian which 'user-name' belong
# The optional 'transport' parameter used for sip protocol, UDP / TCP / TLS / DTLS, default is UDP
# For example : "wh-test" <sip:198970:123456@10.18.0.200:55555;transport=udp>;
FromUri=
# Proxy server address and port for registration, If left blank, server address would automatically derived from `FromUri`.
# likely as '<sip:domain[:port];lr>'
# The 'lr' parameter means loose routing, message is routed through this address but the Request Uri header is not modified.
#   Without this parameter, the Request Uri header and route are both specified as this address.
# For exapmle : <sip:cn-zz-bgp-1.natfrp.cloud:45003;lr>
#               <sip:s0.s100.vip:8395;lr>
#               <sip:10.18.0.200:55555>
RouteUri=
# text in User-Agent header, default is blank and auto filled by eXosip.
AgentText=ZKSipAgent/0.1

## Call settings
[Reg]
# register expires time for seconds in Expires header, default is 120
RegExpires=120
# auto send register after load configuration file, default is false
RegAfterLoad=false
# auto masquerade contact field with rport and received when register, default is false
RegAutoMasquerade=false
[Call]
# auto answer for call, default is true
AutoAnswer=true

*/
